<?php
declare(strict_types=1);


namespace yanlongli\TypePHP;

/**
 * Class TypeMap
 * @package yanlongli\TypePHP
 */
class TypeMap extends TypeArray
{
    protected string $keyType;
    protected string $valType;

    /**
     * TypeMap constructor.
     * @param string $keyType
     * @param string $valType
     */
    public function __construct(string $keyType, string $valType)
    {
        parent::__construct();
        $this->keyType = $keyType;
        $this->valType = $valType;
    }

    public function __get($key)
    {
        return $this->data[$key] ?? null;
    }

    public function __set($key, $val)
    {
        $this->data[$key] = $val;
        return $this;
    }
}
